<template>
	<view class="flex flex-col h-screen">
		<NavBarVue title="咨询师入驻"></NavBarVue>
		<view class="flex-1 overflow-hidden">
			<scroll-view scroll-y class="h-full">
				<view class="px-30">
					<view class="mb-30 bg-white rounded-lg">

						<FromList title="姓名">
							<uni-easyinput v-model="from.name" style="text-align: right" :input-border="false"
								placeholder="请输入姓名"></uni-easyinput>
						</FromList>
						<FromList title="真人照片">
							<view>
								<UpImageVue :src="from.haedImg" imgKey="haedImg" @get-url="setUrl">
								</UpImageVue>
							</view>
						</FromList>
						<FromList title="入驻手机号">
							<uni-easyinput v-model="from.phone" type="tel" style="text-align: right"
								:input-border="false" placeholder="请输入手机号"></uni-easyinput>
						</FromList>
						<FromList title="身份证号码">
							<uni-easyinput v-model="from.idcard" type="tel" style="text-align: right"
								:input-border="false" placeholder="请输入身份证号码"></uni-easyinput>
						</FromList>
						<FromList title="身份证人像面" align="bottom">
							<view>
								<UpImageVue :src="from.idcardfront" imgKey="idcardfront"
									:image-styles="{width:'100%',height:200}" @get-url="setUrl">
									<view class="">
										<ImageBoxVue src="/static/user/id-card-front.png" width="427rpx"
											height="256rpx">
										</ImageBoxVue>
									</view>
								</UpImageVue>
							</view>
						</FromList>
						<FromList title="身份证国徽面" align="bottom">
							<view>
								<UpImageVue :src="from.idcardback" :image-styles="{width:'100%',height:200}"
									imgKey="idcardback" @get-url="setUrl">
									<view class="">
										<ImageBoxVue src="/static/user/id-card-back.png" width="427rpx" height="256rpx">
										</ImageBoxVue>
									</view>
								</UpImageVue>
							</view>
						</FromList>

						<FromList title="学历照片" align="bottom">
							<view class="flex">
								<UpImageVue :src="from.acadimg" imgKey="acadimg" @get-url="setUrl">
								</UpImageVue>
							</view>
						</FromList>
						<FromList title="个人介绍" align="bottom">
							<uni-easyinput v-model="from.troduction" type="textarea" :input-border="false"
								placeholder="请输入手机号"></uni-easyinput>
						</FromList>
					</view>
					<button @click="onSave">提交</button>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script setup>
	import {
		ref
	} from "vue";
	import FromList from '@/components/FromList.vue';
	import cityJSON from "@/static/city.json"
	import UpImageVue from "@/components/UpImage.vue";
	import userApi from "../../apis/apiList/userApi";
	const imageStyles = {
		width: 64,
		height: 64,
	}
	const from = ref({
		name: "", //姓名
		phone: "", //电话
		haedImg: "", //真人照片
		idcard: "", //身份证号码
		idcardfront: "", //身份证正面
		idcardback: "", //身份证背面
		acadimg: "", //学历照片
		troduction: "", //个人介绍
	})
	// const from = ref({
	// 	"name": "测试主播",
	// 	"phone": "17313612112",
	// 	"haedImg": "http://zztarot.ruanmengkeji.cn/fileUp/files/20250312092325344.jpg",
	// 	"idcard": "510704199807114215",
	// 	"idcardfront": "http://zztarot.ruanmengkeji.cn/fileUp/files/20250312092307604.jpg",
	// 	"idcardback": "http://zztarot.ruanmengkeji.cn/fileUp/files/20250312092331713.png",
	// 	"acadimg": "http://zztarot.ruanmengkeji.cn/fileUp/files/20250312092340285.jpg",
	// 	"troduction": "就是个性"
	// })
	const setUrl = (key, url) => {
		console.log(key, url);
		from.value[key] = url
	}
	const onSave = () => {
		console.log(from.value);
		const params = {
			"member.id": uni.getStorageSync('user').id,
			...from.value
		}
		userApi.memberAddAnchorInfo(params).then(res => {
			console.log(res);
			uni.showToast({
				icon: "none",
				title: '注册成功'
			})
			uni.navigateBack({
				delta: 1
			})
		})
	}
	const qualificationList = ["大学本科", "大专", "中专", '初中', "小学", "无"]
	const workTypeList = [{
		text: '全职',
		value: 0
	}, {
		text: '兼职',
		value: 1
	}]
	const serviceList = [{
		text: '星盘',
		value: 0
	}, {
		text: '双人合盘',
		value: 1
	}, {
		text: '骰子',
		value: 2
	}, {
		text: '塔罗牌',
		value: 3
	}, {
		text: '心理',
		value: 4
	}]
	const areaList = [{
		text: '婚姻情感',
		value: 0
	}, {
		text: '心理健康',
		value: 1
	}, {
		text: '运势发展',
		value: 2
	}, {
		text: '学业事业',
		value: 3
	}, {
		text: '星盘解读',
		value: 4
	}, {
		text: '正缘桃花',
		value: 5
	}]
	const styleList = [{
		text: '精准直接',
		value: 0
	}, {
		text: '善解人意',
		value: 1
	}, {
		text: '温柔细腻',
		value: 2
	}, {
		text: '心灵启发',
		value: 3
	}, {
		text: '温暖关怀',
		value: 4
	}, {
		text: '耐心倾听',
		value: 5
	}]
	const onBirthplace = (val) => {
		from.value.residence = val.detail.value.map(a => a.text)
		// from.value.birthpro = val.detail.value[0].value //出生地=省
		// from.value.birthcity = val.detail.value[1].value //出生地=市
		// from.value.birthdis = val.detail.value[2].value //出生地=区县
	}
</script>

<style>

</style>